home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / tcl / tcl70b2.lha / tcl7.0b2 / configure.in < prev    next >
Text File  |  1993-07-19  |  5KB  |  146 lines

  1. dnl    This file is an input file used by the GNU "autoconf" program to
  2. dnl    generate the file "configure", which is run during Tcl installation
  3. dnl    to configure the system for the local environment.
  4. AC_INIT(tcl.h)
  5. AC_PROG_INSTALL
  6. AC_PROG_RANLIB
  7.  
  8. #--------------------------------------------------------------------
  9. #    Supply substitutes for missing POSIX library procedures, or
  10. #    set flags so Tcl uses alternate procedures.
  11. #--------------------------------------------------------------------
  12.  
  13. AC_REPLACE_FUNCS(getcwd opendir strerror strstr strtod)
  14. AC_REPLACE_FUNCS(strtol strtoul tmpnam waitpid)
  15. AC_FUNC_CHECK(gettimeofday, , AC_DEFINE(NO_GETTOD))
  16. AC_FUNC_CHECK(getwd, , AC_DEFINE(NO_GETWD))
  17. AC_FUNC_CHECK(wait3, , AC_DEFINE(NO_WAIT3))
  18.  
  19. #--------------------------------------------------------------------
  20. #    Supply substitutes for missing POSIX header files.  Special
  21. #    notes:
  22. #        - Sprite's dirent.h exists but is bogus.
  23. #        - stdlib.h doesn't define strtol, strtoul, or
  24. #          strtod insome versions of SunOS
  25. #        - some versions of string.h don't declare procedures such
  26. #          as strstr
  27. #--------------------------------------------------------------------
  28.  
  29. AC_UNISTD_H
  30. AC_COMPILE_CHECK(dirent.h, [#include <sys/types.h>
  31. #include <dirent.h>], [
  32. DIR *d;
  33. struct dirent *entryPtr;
  34. char *p;
  35. d = opendir("foobar");
  36. entryPtr = readdir(d);
  37. p = entryPtr->d_name;
  38. closedir(d);
  39. ], tcl_ok=1, tcl_ok=0)
  40. AC_HEADER_EGREP([Sprite version.* NOT POSIX], tcl_ok=0)
  41. if test $tcl_ok = 0; then AC_DEFINE(NO_DIRENT_H); fi
  42. AC_HEADER_CHECK(float.h, , AC_DEFINE(NO_FLOAT_H))
  43. AC_HEADER_CHECK(limits.h, , AC_DEFINE(NO_LIMITS_H))
  44. AC_HEADER_CHECK(stdlib.h, tcl_ok=1, tcl_ok=0)
  45. AC_HEADER_EGREP(strtol, stdlib.h, , tcl_ok=0)
  46. AC_HEADER_EGREP(strtoul, stdlib.h, , tcl_ok=0)
  47. AC_HEADER_EGREP(strtod, stdlib.h, , tcl_ok=0)
  48. if test $tcl_ok = 0; then AC_DEFINE(NO_STDLIB_H); fi
  49. AC_HEADER_CHECK(string.h, tcl_ok=1, tcl_ok=0)
  50. AC_HEADER_EGREP(strstr, string.h, , tcl_ok=0)
  51. AC_HEADER_EGREP(strerror, string.h, , tcl_ok=0)
  52. if test $tcl_ok = 0; then AC_DEFINE(NO_STRING_H); fi
  53. AC_HEADER_CHECK(sys/time.h, , AC_DEFINE(NO_SYS_TIME_H))
  54. AC_HEADER_CHECK(sys/wait.h, , AC_DEFINE(NO_SYS_WAIT_H))
  55.  
  56. #--------------------------------------------------------------------
  57. #    On some systems strstr is broken: it returns a pointer even
  58. #    even if the original string is empty.
  59. #--------------------------------------------------------------------
  60.  
  61. AC_TEST_PROGRAM([
  62. extern int strstr();
  63. int main()
  64. {
  65.     exit(strstr("\0test", "test") ? 1 : 0);
  66. }
  67. ],  , [LIBOBJS="$LIBOBJS strstr.o"])
  68.  
  69. #--------------------------------------------------------------------
  70. #    Under some versions of AIX strtoul returns an incorrect terminator
  71. #    pointer for the string "0".
  72. #--------------------------------------------------------------------
  73.  
  74. AC_TEST_PROGRAM([
  75. extern int strtoul();
  76. int main()
  77. {
  78.     char *string = "0";
  79.     char *term;
  80.     int value;
  81.     value = strtoul(string, &term, 0);
  82.     if ((value != 0) || (term != (string+1))) {
  83.         exit(1);
  84.     }
  85.     exit(0);
  86. }], , [LIBOBJS="$LIBOBJS strtoul.o"])
  87.  
  88. #--------------------------------------------------------------------
  89. #    Check for various typedefs and provide substitutes if
  90. #    they don't exist.
  91. #--------------------------------------------------------------------
  92.  
  93. AC_MODE_T
  94. AC_PID_T
  95. AC_SIZE_T
  96. AC_UID_T
  97.  
  98. #--------------------------------------------------------------------
  99. #    If a system doesn't have an opendir function (man, that's old!)
  100. #    then we have to supply a different version of dirent.h which
  101. #    is compatible with the substitute version of opendir that's
  102. #    provided.  This version only works with V7-style directories.
  103. #--------------------------------------------------------------------
  104.  
  105. AC_FUNC_CHECK(opendir, , AC_DEFINE(USE_DIRENT2_H))
  106.  
  107. #--------------------------------------------------------------------
  108. #    Check for the existence of sys_errlist (this is only needed if
  109. #    there's no strerror, but I don't know how to conditionalize the
  110. #    check).
  111. #--------------------------------------------------------------------
  112.  
  113. AC_COMPILE_CHECK(sys_errlist, , [
  114. extern char *sys_errlist[];
  115. extern int sys_nerr;
  116. sys_errlist[sys_nerr-1][0] = 0;
  117. ], , AC_DEFINE(NO_SYS_ERRLIST))
  118.  
  119. #--------------------------------------------------------------------
  120. #    The check below checks whether <sys/wait.h> defines the type
  121. #    "union wait" correctly.  It's needed because of weirdness in
  122. #    HP-UX where "union wait" is defined in both the BSD and SYS-V
  123. #    environments.  Checking the usability of WIFEXITED seems to do
  124. #    the trick.
  125. #--------------------------------------------------------------------
  126.  
  127. AC_COMPILE_CHECK([union wait], [#include <sys/types.h> 
  128. #include <sys/wait.h>], [
  129. union wait x;
  130. WIFEXITED(x);        /* Generates compiler error if WIFEXITED
  131.              * uses an int. */
  132. ], , AC_DEFINE(NO_UNION_WAIT))
  133.  
  134. #--------------------------------------------------------------------
  135. #    Check to see whether the system supports the matherr function
  136. #    and its associated type "struct exception".
  137. #--------------------------------------------------------------------
  138.  
  139. AC_COMPILE_CHECK([matherr support], [#include <math.h>], [
  140. struct exception x;
  141. x.type = DOMAIN;
  142. x.type = SING;
  143. ], [LIBOBJS="$LIBOBJS tclMtherr.o"; AC_DEFINE(NEED_MATHERR)])
  144.  
  145. AC_OUTPUT(Makefile)
  146.